/*
 *  $Id: GreatHurricane.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Air.Spells {
    public class GreatHurricane: SpellCard {
        public GreatHurricane(): base("001_a_s_great_hurricane") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Air;
            Value = 100;
            AddManaCost(ElementType.Air, 4);
        }

        public override void DoAction(TargetArgs args) {
            foreach (Creature cr in args.Player.GetCreatures())
                DoHurricane(args.Player, cr);
            foreach (Creature cr in args.Player.Enemy.GetCreatures())
                DoHurricane(args.Player, cr);
        }

        private void DoHurricane(Player caster, Creature cr) {
            cr.DamageBy(NewDamage(caster, 2));
            cr.State = CreatureState.Tapped;
            cr.AddAffect<GreatHurricaneAffect>();
        }

        private class GreatHurricaneAffect: SpellAffect<GreatHurricane> {
            public GreatHurricaneAffect(): base() {
                Add(new TimeAffect(4, new Affects.Idler()));
            }
        }
    }
}
